package ua.kpi_java_training.tyshchenko.module2;

/**
 * Class contains habitat's size.
 *
 * @author Vlad Tyshchenko
 * @version 1.1 3 June 2013
 */
public class Habitat {
    private int width;
    private int length;
    private Hurdle hurdle;

    /**
     * The constructor gets size of habitat.
     *
     * @param allData
     */
    public Habitat(AbstractInputAllData allData) {
        width = allData.getWidthHabitat();
        length = allData.getLengthHabitat();
        hurdle = new Hurdle(allData.getCoordinateHurdle());
    }

    public int getWidth() {
        return width;
    }

    public int getLength() {
        return length;
    }

    /**
     * Methods checks pool's cell on the presence hurdle
     *
     * @param position - creature's position
     * @return - true if cell available
     */
    public boolean checkAvailableSpace(Position position) {
        if (hurdle.checkHurdle(position)) {
            return false;
        }
        return true;
    }

}
